package com.example.smart.ui.activity.home

import com.example.lib.constants.JumpConstants
import com.example.lib.extend.getIntentInt
import com.example.lib.extend.setOnDoubleClickListener
import com.example.lib.utils.sp.SpUtils
import com.example.lib.utils.statusbar.StatusBarUtils
import com.example.smart.R
import com.example.smart.base.ui.activity.BaseActivity
import com.example.smart.databinding.ActivityVaccinesPointDetailsBinding
import com.example.smart.utils.DisplayUtils

class VaccinesPointDetailsActivity : BaseActivity<ActivityVaccinesPointDetailsBinding>() {
    private var flag1 = false

    override fun layoutID() = R.layout.activity_vaccines_point_details

    override fun initView() {
        StatusBarUtils.setStateAndNavigationBar(this@VaccinesPointDetailsActivity,
            statusBarColor = com.example.lib.R.color.translate)
        flag1 = SpUtils.getBoolean("vaccines${getIntentInt(JumpConstants.ID, 1)}", false)

        binding.Gz.setImageResource(if (flag1) R.mipmap.icon_heart else R.mipmap.icon_heart_not)
        binding.GzBack.setBackgroundResource(if (flag1) com.example.lib.R.drawable.round_white else R.mipmap.icon_heart_not_back)
    }

    override fun initListener() {
        binding.GzBack.setOnDoubleClickListener {
            flag1 = !flag1
            binding.Gz.setImageResource(if (flag1) R.mipmap.icon_heart else R.mipmap.icon_heart_not)
            binding.GzBack.setBackgroundResource(if (flag1) com.example.lib.R.drawable.round_white else R.mipmap.icon_heart_not_back)
            SpUtils.putBoolean("vaccines${getIntentInt(JumpConstants.ID, 1)}", flag1)
        }

        binding.Gz.setOnDoubleClickListener {
            flag1 = !flag1
            binding.Gz.setImageResource(if (flag1) R.mipmap.icon_heart else R.mipmap.icon_heart_not)
            binding.GzBack.setBackgroundResource(if (flag1) com.example.lib.R.drawable.round_white else R.mipmap.icon_heart_not_back)
            SpUtils.putBoolean("vaccines${getIntentInt(JumpConstants.ID, 1)}", flag1)
        }

        binding.ImageClose.setOnDoubleClickListener {
            finish()
        }

        binding.NowReservation.setOnDoubleClickListener {
            DisplayUtils.toReservation(this@VaccinesPointDetailsActivity)
        }

        binding.Map.setOnDoubleClickListener {
            DisplayUtils.toNavigation(this@VaccinesPointDetailsActivity)
        }
    }


}